export function formatDate(time, flag) {
  let date = new Date(parseInt(time));
  
  let year = date.getFullYear();
  let mon = date.getMonth() + 1;
  let day = date.getDate();
  let hours = date.getHours();
  let mintues = date.getMinutes();
  let seconds = date.getSeconds();
  if (flag == "onlyDate") {
    return year + "-" + mon + "-" + day;
  } else {
    return (
      year + "-" + mon + "-" + day + " " + hours + ":" + mintues + ":" + seconds
    );
  }
}